//
//  HttpRequest.h
//  p2p
//
//  Created by mokai on 14-8-13.
//  Copyright (c) 2014年 cloudyoo. All rights reserved.
//


#import <Foundation/Foundation.h>
#import "HttpResponse.h"
#import "HttpCache.h"
#import "AFHTTPRequestOperation.h"
@interface HttpRequest : NSObject
@property(nonatomic,copy) NSString *api;//相对的,如/user/login api比url优化先级高
@property(nonatomic,copy) NSString *url;//完整http url
@property(strong,nonatomic) NSDictionary *params;
@property(strong,nonatomic) HttpOKBlock ok;
@property(strong,nonatomic) HttpNOBlock no;

@property(strong) AFHTTPRequestOperation *operator;

//文件上传部分
@property(strong) HttpBodyBlock bodyBlock;//文件写入
@property(strong) HttpUploadBlock uploadBlock;//进度

//缓冲器
@property(strong,retain) HttpCache *httpCache;

//请求
-(void)request;
//取消此次请求
-(void)cancel;

+(HttpRequest *)requestWithApi:(NSString *)api;
+(HttpRequest *)requestWithApi:(NSString *)api ok:(HttpOKBlock)ok no:(HttpNOBlock)no;
+(HttpRequest *)requestWithApi:(NSString *)api params:(NSDictionary *)params;
+(HttpRequest *)requestWithApi:(NSString *)api params:(NSDictionary *)params ok:(HttpOKBlock)ok no:(HttpNOBlock)no;

@end
